home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The 640 MEG Shareware Studio 2
/
The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO
/
diag
/
dskbuf22.zip
/
DISKBUF.DOC
< prev
next >
Wrap
Text File
|
1989-11-06
|
23KB
|
608 lines
DISKBUF
A Program to Optimize the BUFFERS= Setting
Version 2.20(4)
by
W. G. Madison
Copyright 1987, '89
W.G. Madison and Associates, Ltd.
All rights reserved.
November 6, 1989
NOTICE: The program DiskBuf and this associated documentation are
copyrighted products. They may be freely distributed, provided
only that both the program and documentation are distributed
together, that no modification is made to either the program or
the documentation, and that no charge other than a copying charge
not to exceed $6.00 is levied on the recipient. Disk distributors
may include promotional text with this program, provided that
such text appears as a separate file or as text appended to this
documentation. If appended to this document, such text must be
readily identifiable as to its source and must appear ONLY at the
end of the document file. Finally, neither the author nor MADISON
AND ASSOCIATES assume any responsibility or liability for actual
or consequential damages arising from the use of this program,
even if they have been notified in advance of the possibility of
occurrence of such damages.
We would like to know of your experience with DiskBuf. Please
address any criticisms or comments to:
W.G. Madison and Associates, Ltd.
Consultants / Information Systems
P. O. Box 898
Greenbelt, MD 20770
(301)552-7234
(CompuServe 73240,342)
* * * * * * * * * * * * * * * * * * * * * * * * *
Acknowledgment: Release 1 of this program was based upon ideas
gleaned from the public domain program THRASHER, by Monte Fergu-
son of Ravenna, OH. This release, 2.00(2), has been enhanced as a
result of several user suggestions received over the intervening
two years. My thanks to all who have contributed.
1
Disclaimer: This program is provided AS IS, with no claim for
suitability for any particular purpose. Specifically, since the
program is necessarily extremely disk intensive and therefore
exercises the head positioning mechanism far more than is custom-
ary in normal use, the Author and W. G. Madison and Associates,
Ltd. disclaim any and all responsibility for actual and/or con-
sequential damages to hardware and/or files resulting from the
use of this program.
INTRODUCTION:
All personal computers using the DOS operating system (PC-
DOS, MS-DOS, etc.) use buffered I/O when reading from or writing
to the disk, unless the programmer who wrote the software being
used went to great lengths to avoid it. The number of buffers
used is specified in the file CONFIG.SYS, which is read at the
time the computer is booted up.
If you are not familiar with the CONFIG.SYS file or with the
concept of buffered I/O, it is strongly suggested that you refer
to your DOS reference manual before proceeding further.
The problem of determining the proper number of buffers with
which to configure a DOS computer is, at best, inadequately add-
ressed in most DOS reference manuals. Generally, the suggested
approach is "Try a number, then use your computer, then try
another number. Keep repeating this process until you are either
fed up or have arrived at something which gives acceptable per-
formance." Some reference manuals give a suggested value to be
used by those looking for an easy out. This suggested value may
or may not yield performance which is close to optimum.
DiskBuf provides a method for scanning through an entire
range of values while you go out for coffee (or something
stronger).
WHY WORRY ABOUT THE NUMBER OF BUFFERS?
As might be expected, buffering uses RAM. Specifically, each
buffer added to a DOS system uses 33 paragraphs (528 bytes) of
RAM. Assuming that plenty of RAM is available, it might be tempt-
ing to take the approach, "Let's just set the number of buffers
way up, and fly with that." Unfortunately, one can reach the
point where more time is spent searching buffers for information
than is necessary or desirable. A point of diminishing returns is
reached.
Similarly, too few buffers will cause the computer to go to
the disk more often than necessary. And, since disk operations
are dreadfully slow in comparison to memory operations, unaccept-
able performance degradation will result.
2
WHY USE THE DISKBUF PROGRAM TO SOLVE THE PROBLEM?
Basically, without an intimate knowledge of the insides of
DOS plus a penchant for solving complex mathematical problems,
there are three feasible methods for attacking the problem. The
first is to pick a number (based either upon your liking for
indulging in Russian roulette, or upon recommendations from
friends or the DOS reference manual) and put your trust in the
tooth fairy as to the appropriateness of the number. The second
is to try to determine the number by systematic trial and error,
editing your CONFIG.SYS file over a period of time. The third
method is to set up an automatic process which can sweep through
a series of values, perform a realistic test with each value, and
record the results for later analysis.
The DISKBUF program permits this third approach to be taken
easily. By using DISKBUF, you can readily determine the optimum
number of buffers to be used, based not only upon time to perform
the test but also upon the amount of RAM occupied by the buffers.
You can decide, and have some rational basis for the decision,
whether you are willing to sacrifice X bytes of additional RAM in
order to gain an additional Y% performance improvement from your
disk operations.
HOW DO I USE DISKBUF?
CAUTIONARY NOTE: If you are using cache in other than normal
memory, under certain circumstances the automatic re-boot will be
inhibited; you will have to manually re-boot at the end of each
test cycle. No other ill effects seem to occur, however, and the
test results appear to be still valid. We have not yet been able
to determine the cause or specifically state the exact circum-
stances under which this will occur.
Nine files are included in the file DISKBUF.ZIP. They are,
respectively:
DISKBUF.DOC (This file)
DISKBUF.EXE (The operational program)
AUTOEXEC.BAT (A specimen AUTOEXEC file)
BUFTST-1.EXE (One of the two provided test modules.
This is the test you would probably want
to use if your typical activity involved
accessing many files scattered over the
disk.)
BUFTST-2.EXE (The second of the two provided test
modules. This is the test you would
probably want to use if your typical
activity involved random accessing of a
relatively few large files.)
BUFFTEST.EXE (A copy of BUFTST-1.EXE. This copy is
the one which will actually be used in
testing.)
3
PLOTFM.EXE (A stand-alone program to produce plots
of figures of merit.)
PLOTBUF.COM (The plot driver program to produce a
screen plot of the test results. Used by
both DISKBUF and by PLOTFM. Assumes a
CGA card. DO NOT ATTEMPT TO RUN PLOTBUF
AS A STAND-ALONE PROGRAM.)
UPDATE.DOC (The revision history of DISKBUF.)
Examine the AUTOEXEC.BAT file. You will see, as the last
line of the file, the line invoking DISKBUF. In the REMark lines
preceding this, you will see guidelines for setting the switch
values to be passed to DISKBUF. The switches are:
/TARGET= (Sets the disk to be tested)
/MAXBUF= (Sets the stopping point (maxi-
mum number of buffers) for the
test)
/MINBUF= (Sets the starting point (mini-
mum number of buffers) for the
test)
/PLOT (If present, a screen plot of
the test results will be pro-
duced)
The first two switches, /TARGET= and /MAXBUF= are required;
the other two, /MINBUF= and /PLOT are optional.
/TARGET=xx takes as an argument a valid disk device
designator, with the appended colon being optional. This deter-
mines the device or partition which is to be tested. (Required)
/MAXBUF=nn takes as an argument an integer between 1 and
99, and determines the greatest number of buffers to be used in
the test. (Required)
/MINBUF=nn also takes as an argument an integer between
1 and 99, and determines the starting number of buffers to be
used in the test. If this switch is omitted, a starting value of
3 will be used. (Optional)
/PLOT determines by its presence or absence whether
or not a screen plot of the test results will be produced at the
completion of the test. NOTE: If your computer does not have a
graphics card, this switch must not be included! (Optional)
To use DISKBUF, the following steps are required.
STEP 1. Format a floppy disk using the /S switch to make
the disk bootable.
STEP 2. Edit the AUTOEXEC.BAT file provided with the
DISKBUF distribution set, to invoke DISKBUF with the switch set-
tings you want used.
4
STEP 3. Copy the edited AUTOEXEC.BAT file and the program
file DISKBUF.COM onto the disk prepared at Step 1.
STEP 4. Copy your own CONFIG.SYS file onto the disk
prepared at Step 1. If necessary, edit the CONFIG.SYS to make
sure that the BUFFERS= parameter is ***OUTSIDE*** the range
determined by the MAXBUF= and MINBUF= parameters in the
AUTOEXEC.BAT file. (For that matter, if you simply delete the
BUFFERS= line from the CONFIG.SYS file, DISKBUF will manage it
appropriately.)
STEP 5. Copy any device drivers to be installed by the
CONFIG.SYS over to the floppy. Do the same for any resident
programs to be installed by the AUTOEXEC.BAT.
STEP 6. Copy DISKBUF.EXE to the floppy. If /PLOT is
selected in the AUTOEXEC.BAT, copy PLOTBUF.COM and, optionally,
PLOTFM.EXE to the floppy.
STEP 7. Decide, based on the descriptions given above,
which of the two test modules you wish to use. Copy the desired
module to the floppy as BUFFTEST.EXE using the DOS COPY command.
(For the average user, we believe that BUFTST-1.EXE more nearly
reflects typical usage; it is therefore the one already set up.)
STEP 8. Re-boot your computer.
STEP 9. Go to lunch, and come back in an hour or so.
(Optional)
When the test is completed, a new file will be on the
floppy disk:
BUFFERS.RPT contains the test results, giving for each
number of buffers tested a figure of merit
and the minimum requirement of RAM (in
bytes) for DOS (given the set of device
drivers and resident programs present dur-
ing the test.)
The figure of merit for a given number of buffers is propor-
tional to the time required for the test. Thus, SMALLER is
BETTER. The minimum figure of merit is the one you want (ignoring
the amount of space occupied by the buffers).
Note that, if /PLOT was selected, the screen plot only dis-
plays a limited range of the figure of merit values. Specific-
ally, the range displayed is from the minimum figure of merit to
5% greater than this value. All figures of merit greater than
this are clipped at this level for plotting purposes. This was
done in order to better present the detail of the values only
slightly worse than the minimum value.
5
The screen plot may be recreated at any time by running
PLOTFM. The only restriction is that the file BUFFERS.RPT and
PLOTBUF.COM must be in the current disk and directory.
Should you wish to test against two different disks or re-
test a disk using two different tests, the file BUFFERS.RPT must
be copied or renamed before the second test is conducted. If this
is not done, the files will be over-written and the results of
the earlier test will therefore be lost.
Should you wish to re-test the disk using the other provided
test, simply return to Step 7 above and proceed from there. It
will not be necessary to edit the CONFIG.SYS file, since (unless
you are also increasing the MAXBUF= setting in the AUTOEXEC.BAT
file) the BUFFERS= setting is guaranteed to be outside the
testing range.
CAN I INCLUDE A DOS SIZE CONSIDERATION IN THE FIGURE OF MERIT?
RUNNING PLOTFM.
As mentioned above, the calculated figure of merit is pro-
portional to the time required to run the test. In most cases, it
is felt that this is an appropriate indicator.
We recognize, however, that there may be installations in
which RAM is critical. For these installations, or if you just
want to re-display the results of an earlier test, the module
PLOTFM.EXE is provided.
PLOTFM.EXE accepts one required and two optional command
line parameters.
PLOTFM <rpt-file> [<time-weight> [<space-weight>]]
<rpt-file> is the name of the DISKBUF output file to be
used. If no extension is provided, .RPT is assumed.
<time-weight> is the relative weight to be given to the time
variable in the calculation of figure of merit.
<space-weight> is the relative weight to be given to the
space variable (i.e., DOS paragraphs) in the calculation of
fighre of merit.
If the two weight factors are omitted from the command line,
the plot produced at the completion of testing will be repro-
duced. (<time-weight> defaults to 1; <space-weight> defaults to
0).
Thus, the following are equivalent:
PLOTFM TEST-A
6
PLOTFM TEST-A.RPT
PLOTFM TEST-A 1 0
PLOTFM TEST-A.RPT 1
and each will produce the same plot display as that produced at
the conclusion of the DISKBUF test run.
We have found that many installations will wish to take
space into account, but not very heavily. In nearly all cases,
basing BUFFERS= settings on plots produced with time weights 20
to 30 times greater than the space weight seems appropriate.
Should RAM be an **EXTREMELY** scarce resource for you, you
might wish to examine the display produced with a time weight as
small as 5 times the space weight.
In calculating the figure of merit, both the time and space
factors are normalized; each time factor is divided by the mini-
mum observed time factor and each space factor is divided by the
minimum observed space factor. The normalized factors are then
multiplied by the appropriate weight, and the weighted factors
are added. This sum is then divided by the sum of the weights to
give a normalized figure of merit. Finally, this normalized fig-
ure of merit is multiplied by the minimum observed time factor to
yield the actual figure of merit.
HOW CAN I DESIGN MY OWN TEST MODULES?
Two fundamentally different test modules are provided which
represent quite different testing scenarios.
BUFTST-1.EXE examines the directory entry for each file in
every directory on the disk being tested. Thus, it simulates a
situation in which the user is accessing many files in any given
session.
BUFTST-2.EXE writes a single large (1000 record, 100 bytes
per record) file in the root directory of the target disk. It
then interchanges record 1 with record 1000, record 2 with record
999, etc. Having completed this sub-test, it then interchanges
record 1 with record 2, record 2 with record 3, ... record 999
with record 1000. Thus, it simulates both sequential and random
usage of large files.
You are free to generate your own tests as you will. These
tests can be implemented in either executable (.EXE or .COM)
files, or in batch control (.BAT) files. In either case, the file
name **must** be BUFFTEST (i.e., BUFFTEST.COM, BUFFTEST.EXE, or
BUFFTEST.BAT). The test module must expect a single command line
parameter of the form <d>:\ where <d> is the drive letter of the
7
drive to be tested.
One word of caution. It is important that the operations
being performed be exactly duplicated from run to run, if the
output data are to accurately reflect your system behavior. Thus
if you have, e.g., put together a batch file (BUFFTEST.BAT) which
performs a MAKE, it is important that you recognize ahead of time
just which files will be created as a result of the MAKE, and
delete them prior to terminating your BUFFTEST.BAT.
8
HOW DOES DISKBUF DO ALL THAT GOOD STUFF?
When DISKBUF is invoked, it performs the following
steps:
STEP 0. Read and parse command tail. Set operating par-
ameters, based on the contents of the command tail.
STEP 1. Edit the file CONFIG.SYS on the floppy disk.
STEP 1A. If the BUFFERS= line is present, read it to
extract the current BUFFERS= setting.
STEP 1A1. If this setting is not between MINBUF
and MAXBUF then re-write CONFIG.SYS with a
BUFFERS= setting equal to the value of MINBUF,
and go to STEP 1C.
STEP 1A2. If the setting is between MINBUF and
MAXBUF then go to STEP 2.
STEP 1B. If not present, append a BUFFERS= statement
with a BUFFERS= setting equal to the value of MINBUF.
STEP 1C. Delete the BUFFERS.RPT file if it is pres-
ent, and re-boot the system.
STEP 2. Start the timer.
STEP 3. Perform the selected test.
STEP 4. Stop the timer.
STEP 5. Calculate the figure of merit, and append a record
to BUFFERS.RPT.
STEP 6. Check the current setting of BUFFERS= against the
value of MAXBUF.
STEP 6A. If buffer setting < MAXBUF, re-edit the
existing CONFIG.SYS file, incrementing the buffer set-
ting and re-boot the system.
STEP 6B. Otherwise, the test is completed.
STEP 6B1. Leave the CONFIG.SYS file on the floppy
disk with a BUFFERS= setting at MAXBUF + 1.
STEP 6B2. If /PLOT is selected, plot the test
results.
STEP 6B3. Exit to DOS.
9
10